<!DOCTYPE html>
<html xmlns:th="http://www.w3.org/1999/xhtml">
<meta charset="utf-8">
<link rel="stylesheet" href="/css/bootstrap-datetimepicker.min.css" />
<head th:include="include :: header"></head>
<link href="/js/plugins/layui/css/layui.css" rel="stylesheet">
<body class="gray-bg">
<div class="wrapper wrapper-content animated fadeInRight">
	<div class="row">
		<div class="col-sm-12">
			<div class="ibox-content">
				<form id="agentForm" class="form-horizontal m-t" >
					<input id="agentId" name="agentId" th:value="${agent.agentId}" class="form-control" type="hidden">
					<div class="form-group">
						<label class="col-sm-2 control-label">上级代理商：</label>
						<div class="col-sm-4" >
							<span class="form-control" th:text="${parentAgent}"></span>
						</div>
						<label class="col-sm-2 control-label">代理商名称：</label>
						<div class="col-sm-4">
							<input id="agentName" name="agentName" class="form-control" type="text" th:value="${agent.agentName}" readonly>
						</div>
					</div>
					<div class="form-group">
						<label class="col-sm-2 control-label">通道分类：</label>
						<div class="col-sm-4">
							<select id="payChannelType" name="payChannelType" class="form-control">
								<option th:each="pct:${payChannelTypes}" th:value="${pct.key}" th:text="${pct.value}" th:selected="${agent.payChannelType==pct.key}"></option>
							</select>
						</div>
					</div>
					<div class="form-group">
						<label class="col-sm-2 control-label">联系人：</label>
						<div class="col-sm-4">
							<input id="contacts" name="contacts"  th:value="${agent.contacts}" class="form-control" maxlength="20" readonly type="text">
						</div>
						<label class="col-sm-2 control-label">联系人电话：</label>
						<div class="col-sm-4">
							<input id="contactsPhone" name="contactsPhone" th:value="${agent.contactsPhone}" maxlength="12" class="form-control" readonly type="text">
						</div>
					</div>
					<div class="form-group">
						<label class="col-sm-2 control-label">联系人邮箱：</label>
						<div class="col-sm-4">
							<input id="contactsEmail" name="contactsEmail" th:value="${agent.contactsEmail}" maxlength="60" class="form-control" readonly type="email">
						</div>
						<label class="col-sm-2 control-label">联系人QQ：</label>
						<div class="col-sm-4">
							<input id="contactsQq" name="contactsQq" th:value="${agent.contactsQq}" class="form-control" maxlength="15" readonly type="number">
						</div>
					</div>

					<div class="form-group" th:each="payCoin:${payCoins}">
						<label class="col-sm-2 control-label" th:text="${payCoin.value + '费率：'}"></label>
						<div class="col-sm-2">
							<input th:id ="coinRate_+${payCoin.key}" readonly class="form-control" min="0" maxlength="4" type="number" required>
						</div>
						<div class="col-sm-4">
							<label th:each="unit:${rateUnits}" class="radio-inline">
								<input th:name="coinRateUnit_+${payCoin.key}" disabled  type="radio" th:value="${unit.key}"
									   th:text="${unit.value}">
							</label>
						</div>
					</div>
				</form>
			</div>
		</div>
	</div>
</div>
<div th:include="include::footer"></div>
<script th:inline="javascript">
    /*<![CDATA[*/
    payCoins = [[${payCoins}]];
    coinRate = [[${agent.coinRate}]];
    /*]]>*/
</script>
<script type="text/javascript" src="/js/plugins/layui/layui.js"></script>
<script type="text/javascript" src="/js/bootstrap-datetimepicker.min.js"></script><!-- 日期框 -->
<script type="text/javascript" src="/js/bootstrap-datetimepicker.zh-CN.js"></script><!-- 日期框 -->
</script>
<script type="text/javascript">
    $(function(){
        for(payCoin in payCoins){
            var unitVal = 1;
            if(coinRate && coinRate[payCoin]){
                $("#coinRate_" + payCoin).val(coinRate[payCoin].rate);
                unitVal = coinRate[payCoin].unit || 1;
                $("input[name=coinRateUnit_" + payCoin + "]").each(function(){
                    if($(this).val() == unitVal){
                        $(this).prop("checked","checked");
                    }
                })
            }
        }
    })
</script>
</body>
</html>
